var util = require('../../../../utils/util.js')
var _this
const noteBirdthday = '请选择出生日期'
Page({
    data: {
      birdthDay: noteBirdthday,
      dateSelected:'unselectedColor',
      isDatePikcerShow:false,
      date: util.formatTime(new Date),
    },
    showDatePicker: function() {
      this.setData({
        isDatePikcerShow:true
      })
      console.log(this.data.isDatePikcerShow)
    },
    bindDateChange(e) {
      this.setData({
        birdthDay: e.detail.value,
        dateSelected:"selectedColor"
      })
      _this.handleUpdate()
      setTimeout(function () {
        wx.navigateTo({
          url: '../infoSchool/infoSchool',
        })
      }, 300)
    },
    bindDateCancel: function(e){
      this.setData({
        birdthDay: noteBirdthday,
        dateSelected: "unselectedColor"
      })
    },
    onReady: function(e){
      const context = wx.createCanvasContext('arrowCanvas')
      context.setStrokeStyle("black")
      context.setLineWidth(3)
      context.setLineJoin("miter")
      context.moveTo(0,10);
      context.lineTo(10,20)
      context.moveTo(10,20)
      context.lineTo(20,10)
      context.stroke()
      context.draw()
    },
    onLoad: function() {
      _this = this;
    },
  handleUpdate: () => {
    var data = { 'birthday': _this.data.birdthDay }
    util.updateUserInfo(_this.requestDidResponse, _this.requestDidFaild, data)
  },
  requestDidResponse: (res) => {
    console.log('did receive response: ' + res)
    if (res.status == '200') {
    }
  },
  requestDidFaild: (res) => {

  }
})